home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 December / PCWorld_2004-12_cd.bin / software / temacd / tiny / tf6pro-6[1].0.140.exe / Tiny Firewall Pro 6.0.msi / Event_compact.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-20  |  9.2 KB  |  316 lines

  1. <?xml version='1.0' ?>
  2. <!-- /*//////////////////////////////////////////////////////////////////////
  3. //filename:         log.xsl
  4. //copyright(c):     Tiny Software corp 2002 - 2004 (http://www.tinysoftware.com)
  5. //author:         Jozef Palocko (jpalocko@tinysoftware.com)
  6. //product:         Tiny Firewall 6.x                
  7. //description:     Log analyzer stylesheet
  8. //changelog:    
  9. //    18.8.2003 - added displaying date in local time zone
  10. ///////////////////////////////////////////////////////////////////////*/ -->
  11. <xsl:stylesheet version="1.0" 
  12.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  13.     xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  14.     xmlns:time="http://mycompany.com/mynamespace"
  15.     xmlns:apps="http://mycompany.com/mynamespace">
  16.  
  17.  
  18. <xsl:import href="log.xsl"/>
  19. <!--xsl:output method="html" indent="yes" /-->
  20.  
  21.    <xsl:template match="/">
  22.    <style> 
  23.        <xsl:text>
  24.        BODY {
  25.                font-family: "MS Sans serif", "Verdana", "Tahoma" ;
  26.                 font-size: 10px;
  27.                 background-color: #ffffff;  
  28.                 color:#000000;
  29.             }       
  30.         .clsEvent{
  31.             background-color: #fafafa;  
  32.             text-align : left;
  33.            margin-bottom: 10px;
  34.             }    
  35.         .clsAllow{
  36.         color =#2e8b57;
  37.         font-weight : bold;
  38.         }            
  39.         .clsPrevent{
  40.         color =#ff0000;
  41.         font-weight : bold;
  42.         }            
  43.         .clsAskUser{
  44.         color =#00ffff;
  45.         font-weight : bold;
  46.         }            
  47.  
  48.  
  49.        </xsl:text>
  50.        </style>
  51.     
  52.     <table class="clsTable" style="color:black" width="100%">
  53.         <tr>
  54.             <th align="left">
  55.                 Count
  56.             </th>
  57.             <th align="left">
  58.                 Module
  59.             </th>
  60.             <th align="left">
  61.                 Application
  62.             </th>
  63.             <th align="left">
  64.                 Access
  65.             </th>
  66.             <th align="left">
  67.                 Object
  68.             </th>
  69.             <th align="left">
  70.                         Date
  71.             </th>
  72.             <th align="left">
  73.                 User
  74.             </th>
  75.             <th align="left">
  76.                 Domain
  77.             </th>
  78.             
  79.             
  80.         </tr>
  81.     <xsl:call-template name="tplModule">
  82.         <xsl:with-param name="Events" select="/Root/Event"/>
  83.     </xsl:call-template>
  84.     </table>
  85. </xsl:template>
  86.  
  87.    <!-- ///////// Object //////////// -->
  88.    <xsl:template match="Object">
  89.    <b>
  90.    <!--        <xsl:value-of select="@ot"></xsl:value-of> -->
  91.    <!--xsl:choose>
  92.         <xsl:when test="@ot='0x00000001'">File</xsl:when>
  93.         <xsl:when test="@ot='0x00000002'">Service</xsl:when>
  94.         <xsl:when test="@ot='0x00000004'">Registry key</xsl:when>
  95.         <xsl:when test="@ot='0x00000008'">Spawning object</xsl:when>
  96.         <xsl:when test="@ot='0x00000010'">Device</xsl:when>
  97.         <xsl:when test="@ot='0x00000020'">VBA Macro</xsl:when>
  98.         <xsl:when test="@ot='0x00000040'">COM object</xsl:when>
  99.         <xsl:when test="@ot='0x00000080'">System privileges</xsl:when>
  100.         <xsl:when test="@ot='0x00000400'">Transport object</xsl:when>
  101.         <xsl:when test="@ot='0x10000000'">Action</xsl:when>
  102.         <xsl:when test="@ot='0x20000000'">Message</xsl:when>
  103.       </xsl:choose-->
  104.     </b>
  105.       <xsl:if test="(.!='') and (.!=' ')">
  106.       <!--    <br/>
  107.           <I>Object : </I> -->
  108.           <xsl:value-of select="." />
  109.       </xsl:if>
  110.    </xsl:template>
  111.    
  112. <msxsl:script language="JScript" implements-prefix="apps">
  113.   <![CDATA[
  114.    function GetFileNameFromAppPath( node ) {
  115.        if (!node)
  116.              return node;
  117.              
  118.           var strPath = node.nextNode.text;
  119.           if (! strPath)
  120.            return strPath;
  121.        
  122.        // find the \ from the end and truncate everything before
  123.        var I = 0;
  124.        for (I=strPath.length; I>0; I--) 
  125.        {
  126.            if ("\\" == strPath.charAt(I-1))
  127.            break;
  128.          }
  129.          
  130.          return strPath.substr(I);   
  131.    }
  132.    ]]>
  133. </msxsl:script>
  134.  
  135. <!-- ///////// App //////////// -->
  136.    <xsl:template match="App">
  137.       <xsl:element name="a">
  138.         <xsl:attribute name="title"><xsl:value-of select="."/></xsl:attribute>
  139.         <xsl:value-of select="apps:GetFileNameFromAppPath(.)"/>
  140.     </xsl:element>      <!-- <xsl:value-of select="." />
  141.       <xsl:if test="@chksm">
  142.          <B> Chksm: </B>
  143.          <xsl:value-of select="@chksm" />
  144.       </xsl:if> -->
  145.    </xsl:template>
  146.    
  147.    <!-- ///////// Action //////////// -->
  148.    <xsl:template match="Action">
  149.        <!--xsl:choose>
  150.              <xsl:when test="@ar=1">
  151.                 <span class="clsAllow"> Allow </span>
  152.           </xsl:when>
  153.           <xsl:when test="@ar=0">
  154.                 <span class="clsPrevent"> Prevent</span>
  155.           </xsl:when>
  156.           <xsl:when test="@ar=2">
  157.                 <span class="clsAskUser"> Ask User</span>
  158.           </xsl:when>
  159.          </xsl:choose-->
  160.         
  161.       <!--
  162.       <xsl:if test="@fnc">
  163.           <br/>
  164.          <I>Fnc : </I>
  165.          <xsl:variable name="ID" select="@fnc" />    <xsl:value-of select="$Def//Fnc[@id_dec=$ID]" /> (<xsl:value-of select="$ID" />)
  166.       </xsl:if>
  167.       -->
  168.       <!--xsl:value-of select="." /-->
  169.       <xsl:if test="@fncMsg"><xsl:value-of select="@fncMsg" />
  170.        </xsl:if>
  171.   </xsl:template>
  172.    
  173.    <!-- ///////// Msg //////////// -->
  174.    <xsl:template match="Msg">
  175.       <B>Msg: </B>
  176.       <xsl:value-of select="." />
  177.      <!--- ///// if App element is missing, insert empty table cell //// -->
  178.     <!--xsl:if test="normalize-space(following-sibling::App)=''">
  179.         <td></td>
  180.     </xsl:if-->
  181.    </xsl:template>
  182.    
  183.    <!-- ///////// InetDef //////////// -->
  184.    <xsl:template match="InetDef">
  185.       <B>Prot: </B>
  186.       <xsl:value-of select="@prot" />
  187.       <xsl:if test="@dir">
  188.         <B>  Dir: </B>
  189.         <xsl:value-of select="@dir" />
  190.       </xsl:if>
  191.       <xsl:if test="@remIp">
  192.         <B>  RemIp: </B>
  193.         <xsl:value-of select="@remIp" />
  194.       </xsl:if>
  195.       <xsl:if test="@locPort">
  196.          <B>  LocPort: </B>
  197.           <xsl:value-of select="@locPort" />
  198.       </xsl:if>
  199.       <xsl:if test="@remPort">
  200.          <B>  RemPort: </B>
  201.          <xsl:value-of select="@remPort" />
  202.       </xsl:if>
  203.       <xsl:if test="@icmpFn">
  204.          <B>  IcmpFn: </B>
  205.          <xsl:value-of select="@icmpFn" />
  206.       </xsl:if>
  207.       <xsl:if test="@locIp">
  208.          <B>  LocIp: </B>
  209.          <xsl:value-of select="@locIp" />
  210.       </xsl:if>
  211.    </xsl:template>
  212.  
  213.    <!-- ///////// Event //////////// -->
  214. <xsl:template match="Event">
  215.     <xsl:param name="Total"/>
  216.     <xsl:param name="Events"/>
  217.  
  218.         <xsl:if test="($Filter//cnt=0) or (position()>$Total - $Filter//cnt)">
  219.             <tr height="30">
  220.                 <xsl:attribute name="bgcolor">
  221.                     <xsl:choose>
  222.                         <xsl:when test='.//Action="Prevented"'>#ffc9c6</xsl:when>
  223.                         <xsl:when test='.//Action="Allowed"'>#dbfeda</xsl:when>
  224.                         <xsl:otherwise>
  225.                             #ffffd7
  226.                         </xsl:otherwise>
  227.                     </xsl:choose>
  228.                 </xsl:attribute>
  229.                 <xsl:variable name="NextSiblingPos" select="position()+1"/>
  230.                 <td>
  231.                 <img>
  232.                 <xsl:attribute name="src">
  233.                     <xsl:choose>
  234.                         <xsl:when test='Action="Prevented"'>prevent.gif</xsl:when>
  235.                         <xsl:when test='Action="Allowed" and Object//@ot="Message"'>information.gif</xsl:when>
  236.                         <xsl:otherwise>monitor.gif</xsl:otherwise>
  237.                     </xsl:choose>
  238.                 </xsl:attribute>
  239.                 </img>
  240.                 <xsl:choose>
  241.                     <xsl:when test="$Filter//sort='App'">
  242.                         <xsl:variable name="thisApp" select="App"/>
  243.                         <xsl:variable name="thisUser" select="@user"/>
  244.                         <xsl:variable name="thisDomain" select="@domain"/>
  245.                         <xsl:variable name="thisModule" select="@module"/>
  246.                         <xsl:variable name="thisAction" select="Action"/>
  247.                         <xsl:variable name="thisMsg" select="Msg"/>
  248.                         <xsl:variable name="thisProt" select="InetDef/@prot"/>
  249.                         <xsl:variable name="thisDir" select="InetDef/@dir"/>
  250.                         <xsl:variable name="thisRemPort" select="InetDef/@remPort"/>
  251.                         <xsl:variable name="thisRemIp" select="InetDef/@remIp"/>
  252.                         <xsl:variable name="equalEvents" select="$Events[
  253.                             (@module=$thisModule) and
  254.                             (App=$thisApp or (count($thisApp)=0 and count(App)=0)) and
  255.                             (@user=$thisUser or (count($thisUser)=0 and count(@user)=0)) and
  256.                             (@domain=$thisDomain or (count($thisDomain)=0 and count(@domain)=0)) and
  257.                             (Action=$thisAction) and
  258.                             (not($thisModule='IDS') or $thisMsg=Msg) and
  259.                             (not($thisModule='Firewall') or ($thisProt=InetDef/@prot and
  260.                                                     (count($thisDir)=0 and count(InetDef/@dir)=0 or $thisDir=InetDef/@dir) and
  261.                                                     (count($thisRemPort)=0 and count(InetDef/@remPort)=0 or $thisRemPort=InetDef/@remPort) and
  262.                                                     (count($thisRemIp)=0 and count(InetDef/@remIp)=0 or $thisRemIp=InetDef/@remIp)
  263.                                                    )
  264.                             )
  265.                                                     
  266.                             ]"/>
  267.                         <a>  </a>
  268.                         <xsl:value-of select="count($equalEvents)"/>
  269.                     </xsl:when>
  270.                     <xsl:otherwise>
  271.                         <xsl:if test="@count">
  272.                             <a>  </a>
  273.                             <xsl:value-of select="@count" />
  274.                         </xsl:if>
  275.                     </xsl:otherwise>
  276.                     </xsl:choose>
  277.                 </td>
  278.                 <td>
  279.  
  280.                     <xsl:value-of select="@module"/>
  281.                 </td>
  282.             
  283.                  <td>
  284.                  <xsl:apply-templates select="App" />
  285.                  </td>
  286.                  <td>
  287.                       <xsl:apply-templates select="Action" />
  288.                       </td>
  289.                       <td>
  290.                       <xsl:apply-templates select="Object" />
  291.                       <xsl:apply-templates select="InetDef" />
  292.                       <xsl:apply-templates select="Msg" />
  293.                       </td>
  294.                                                       
  295.                 <td>
  296.                     <xsl:value-of select="time:LocalTime(.)"/>
  297.                 </td>
  298.                 <td>
  299.                     <xsl:if test="@user">
  300.                             [<xsl:value-of select="@user" />]
  301.                     </xsl:if> 
  302.                 </td>
  303.                 <td>
  304.                     <xsl:if test="@domain">
  305.                             [<xsl:value-of select="@domain" />]
  306.                     </xsl:if> 
  307.                 </td>
  308.             
  309.  
  310.             <!--/div-->
  311.             </tr>
  312.         </xsl:if>
  313. </xsl:template>
  314.  
  315. </xsl:stylesheet>
  316.